<?php
declare (strict_types=1);

namespace app\common\validate;


class CodeGeneration extends ValidateBase
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'table' => ['require'],
        'vuePath' => ['require'],
        'module' => ['require'],
        'isRewrite' => ['require'],
        'tableColumns' => ['require'],
        'editColumns' => ['require'],
        'comment' => ['require'],
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'editColumns.require' => '编辑页的字段不能为空',
        'isRewrite.require' => '请选择是否覆盖已有文件',
        'module.require' => '请选择后端模块',
        'table.require' => '请选择数据表',
        'tableColumns.require' => '列表页字段不饿能为空',
        'vuePath.require' => '前端项目更目录不能为空',
        'comment.require' => '数据库备注不能为空',
    ];

    /**
     * 验证场景
     * 格式：'场景'=>['需要验证的字段']
     */
    protected $scene = [
        'generation' => ['table', 'vuePath', 'module', 'isRewrite', 'tableColumns', 'editColumns', 'comment']
    ];
}
